// ignore_for_file: must_be_immutable

import 'package:flutter/material.dart';

void main() {
  runApp(const MaterialApp(
    home: MyText(),
  ));
}

class MyText extends StatefulWidget {
  const MyText({super.key});

  @override
  State<MyText> createState() => _MyTextState();
}

class _MyTextState extends State<MyText> {
  int _selectedIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('这是title')),
      body: const Text('这是文本'),
      bottomNavigationBar: BottomNavigationBar(
        selectedItemColor: Colors.blueAccent,
        type: BottomNavigationBarType.fixed,
        currentIndex: _selectedIndex,
        onTap: (v) {
          setState(() {
            _selectedIndex = v;
          });
        },
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
          BottomNavigationBarItem(icon: Icon(Icons.settings), label: '设置'),
          BottomNavigationBarItem(icon: Icon(Icons.add), label: '发布'),
          BottomNavigationBarItem(icon: Icon(Icons.category), label: '菜单'),
          BottomNavigationBarItem(
              icon: Icon(Icons.my_library_add), label: '我的'),
        ],
      ),
      floatingActionButton: Container(
          width: 60,
          height: 60,
          // color: Colors.white,
          padding: const EdgeInsets.all(10),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(30),
            color: Colors.white,
          ),
          child: FloatingActionButton(
            backgroundColor: Colors.blueAccent,
            foregroundColor: Colors.white,
            child: const Icon(Icons.add),
            onPressed: () {
              print('点击了');
            },
          )),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
      // drawer: const Drawer(
      //   child: Column(
      //     children: [
      //       Row(
      //         children: [
      //           Expanded(
      //               flex: 1,
      //               child: DrawerHeader(
      //                 decoration: BoxDecoration(
      //                     color: Colors.yellow,
      //                     image: DecorationImage(
      //                         image: NetworkImage(
      //                             'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLDEYWBo9eGlSzicLOsiaewkzPicaPtpIVtvUKekSF6icdxLRb4bBImYzcPEQFaRFVaBTFjibO5WIN9PVg/132'),
      //                         fit: BoxFit.cover)),
      //                 margin: EdgeInsets.only(bottom: 0),
      //                 padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
      //                 child: ListTile(
      //                   leading: SizedBox(
      //                     width: 30,
      //                     height: 30,
      //                     // foregroundDecoration: (),
      //                     child: CircleAvatar(
      //                       backgroundColor: Colors.blue,
      //                       foregroundColor: Colors.white,
      //                       child: Icon(Icons.person, size: 18),
      //                     ),
      //                   ),
      //                   title: Text('个人中心'),
      //                 ),
      //               )),
      //         ],
      //       ),
      //       ListTile(
      //         leading: SizedBox(
      //           width: 30,
      //           height: 30,
      //           // foregroundDecoration: (),
      //           child: CircleAvatar(
      //             backgroundColor: Colors.blue,
      //             foregroundColor: Colors.white,
      //             child: Icon(Icons.person, size: 18),
      //           ),
      //         ),
      //         title: Text('个人中心'),
      //       ),
      //     ],
      //   ),
      // ),

      drawer: Drawer(
        child: Column(
          children: [
            Row(
              children: [
                Expanded(
                    flex: 1,
                    child: UserAccountsDrawerHeader(
                        accountName: const Text('张三'),
                        accountEmail: const Text('1410477891@qq,com'),
                        otherAccountsPictures: [
                          Image.network(
                              'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLDEYWBo9eGlSzicLOsiaewkzPicaPtpIVtvUKekSF6icdxLRb4bBImYzcPEQFaRFVaBTFjibO5WIN9PVg/132')
                        ],
                        currentAccountPicture: const CircleAvatar(
                          backgroundImage: NetworkImage(
                              'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLDEYWBo9eGlSzicLOsiaewkzPicaPtpIVtvUKekSF6icdxLRb4bBImYzcPEQFaRFVaBTFjibO5WIN9PVg/132'),
                        ),
                        decoration: const BoxDecoration(
                            color: Colors.blue,
                            image: DecorationImage(
                                image: NetworkImage(
                                    'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLDEYWBo9eGlSzicLOsiaewkzPicaPtpIVtvUKekSF6icdxLRb4bBImYzcPEQFaRFVaBTFjibO5WIN9PVg/132'),
                                fit: BoxFit.cover)))),
              ],
            ),
            const ListTile(
              leading: SizedBox(
                width: 30,
                height: 30,
                // foregroundDecoration: (),
                child: CircleAvatar(
                  backgroundColor: Colors.blue,
                  foregroundColor: Colors.white,
                  child: Icon(Icons.person, size: 18),
                ),
              ),
              title: Text('个人中心'),
            ),
          ],
        ),
      ),
      endDrawer: const Drawer(
        child: Text('右侧侧脸变'),
      ), // endDrawer: const EndDrawerButton(
      //     style: ButtonStyle(
      //         backgroundColor: MaterialStatePropertyAll(Colors.black))),
    );
  }
}
